package com.sanpu.kxe.business.main.view;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.sanpu.kxe.R;
import com.sanpu.kxe.base.BasePopup;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Description：保存、分享图片弹框
 * Created by 薛勇军 on 2018/7/26.
 */

public class ShareAppPopupView extends BasePopup<ShareAppPopupView> {
    @Bind(R.id.save)
    TextView vSave;
    @Bind(R.id.share)
    TextView vShare;

    private IShareAppListener shareListener;

    public void setShareAppListener(IShareAppListener shareListener) {
        this.shareListener = shareListener;
    }

    public ShareAppPopupView(Context context) {
        super(context);
    }

    @Override
    public View onCreatePopupView() {
        View inflate = View.inflate(mContext, R.layout.popup_share, null);
        ButterKnife.bind(this, inflate);
        return inflate;
    }

    @OnClick({R.id.save, R.id.share})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.save:
                shareListener.saveImage();
                break;
            case R.id.share:
                shareListener.shareImage();
                break;
            default:
                return;
        }
        dismiss();
    }

    @Override
    public void setUiBeforShow() {

    }

    /**
     * 接口点击事件定义
     */
    public interface IShareAppListener {

        /**
         * 保存图片
         */
        void saveImage();

        /**
         * 分享App
         */
        void shareImage();
    }
}
